package nerdicide.experiments.reasoning;

import java.util.ArrayList;

import nerdicide.utils.FileUtilities;

/**
 * 
 * @author Brent
 *
 */
public class Main {
	
	private static String QUESTIONS_DIRECTORY = "C:/Users/Brent/workspace/cognition-experiment-library/src/java/nerdicide/experiments/reasoning/questions/";

	private static String currentForm = MultipleChoiceQuestion.PLAIN_FORM;
	
	public static void main(String [] args) {
		ArrayList<String> questionFiles = FileUtilities.getFileNamesInDirectory(QUESTIONS_DIRECTORY, ".properties");
		ArrayList<MultipleChoiceQuestion> questions = new ArrayList<MultipleChoiceQuestion> ();
		for(String questionFile : questionFiles) {
			questions.add(Questions.loadQuestion(QUESTIONS_DIRECTORY.concat(questionFile)));
		}
		printQuestionsToConsole(questions);
		currentForm = MultipleChoiceQuestion.UNFAMILIAR_NOUN_FORM;
		printQuestionsToConsole(questions);
		currentForm = MultipleChoiceQuestion.UNFAMILIAR_VERB_FORM;
		printQuestionsToConsole(questions);
	}	
	
	private static void printQuestionsToConsole(ArrayList<MultipleChoiceQuestion> questions) {
		for(MultipleChoiceQuestion question : questions) {
			printNextForm(question);
		}
		System.out.println("\n\n\n");
	}
	
	private static void printNextForm(MultipleChoiceQuestion question) {
		if(currentForm.equals(MultipleChoiceQuestion.PLAIN_FORM)) {
			System.out.println(question.getPlainFormModel());
			currentForm = MultipleChoiceQuestion.UNFAMILIAR_NOUN_FORM;
		} else if(currentForm.equals(MultipleChoiceQuestion.UNFAMILIAR_NOUN_FORM)) {
			System.out.println(question.getUnfamiliarNounFormModel());
			currentForm = MultipleChoiceQuestion.UNFAMILIAR_VERB_FORM;
		} else if(currentForm.equals(MultipleChoiceQuestion.UNFAMILIAR_VERB_FORM)) {
			System.out.println(question.getUnfamiliarVerbFormModel());
			currentForm = MultipleChoiceQuestion.PLAIN_FORM;
		}
	}
}
